GtkFontButton: Avoid criticals
authorMatthias Clasen <mclasen@redhat.com>
Fri, 15 Aug 2014 19:15:45 +0000 (15:15 -0400)
committerMatthias Clasen <mclasen@redhat.com>
Fri, 15 Aug 2014 19:15:45 +0000 (15:15 -0400)
The font_family and font_face members may be NULL, and we
shouldn't cause critical warnings in that case.

gtk/gtkfontbutton.c

index cb0822f93eff7763836bea3ebbc8dd80b5740450..867d82fa55182f5a2a2322f4c2f145cb4f3cebef 100644 (file)
@@ -1146,8 +1146,14 @@ gtk_font_button_update_font_info (GtkFontButton *font_button)
   const gchar *face_name;
   gchar *family_style;
 
-  fam_name = pango_font_family_get_name (priv->font_family);
-  face_name = pango_font_face_get_face_name (priv->font_face);
+  if (priv->font_family)
+    fam_name = pango_font_family_get_name (priv->font_family);
+  else
+    fam_name = _("None");
+  if (priv->font_face)
+    face_name = pango_font_face_get_face_name (priv->font_face);
+  else
+    face_name = "";
 
   if (priv->show_style)
     family_style = g_strconcat (fam_name, " ", face_name, NULL);